package com.tosit.bmx.mapper;

import com.tosit.bmx.domian.*;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface SubjectMapper {

    long countByExample(SubjectExample example);

    int deleteByExample(SubjectExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Subject record);

    int insertSelective(Subject record);

    List<Subject> selectByExample(SubjectExample example);

    Subject selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Subject record, @Param("example") SubjectExample example);

    int updateByExample(@Param("record") Subject record, @Param("example") SubjectExample example);

    int updateByPrimaryKeySelective(Subject record);

    int updateByPrimaryKey(Subject record);
    /**
     * 根据套题id查找套题
     *
     * @param seid
     * @return
     * @author tsl
     * @date 2018/4/24 14:31
     */
    List<SubjectVo> selectBySeId(@Param("seid") Integer seid);
    /**
     * 查找所有题
     *
     * @return
     * @author tsl
     * @date 2018/4/24 14:31
     */
    List<Subject> getAllSub();
    /**
     * 查找对应类型的所有题
     *@param  type 0单选 1判断 2多选
     * @return
     * @author tsl
     * @date 2018/4/24 14:31
     */
    List<Subject> selectByType(@Param("type") Integer type);
    /**
     * 关键词或者ID查找题
     *@param  keyCode 查询条件
     * @return
     * @author tsl
     * @date 2018/4/24 14:31
     */
    List<Subject> seekByKeyCode(@Param("keyCode") String keyCode);
    /**
     * 删除一个或多个题
     *
     * @param ids
     * @return
     * @author tsl
     * @date 2018/4/24 14:31
     */
    Integer deleteByids(@Param("ids") List<Integer> ids);
    /**
     *  通过所选套题获取题目
     * @author tsl
     * @date 2018/4/28 9:52
     * @param
     * @return
     */
    List<SubjectVo> selectSubjectBySeIds(@Param("seids") List<Integer> seids);

    List<SubjectVo> selectSubjectByCourses(@Param("courId") Integer courId,@Param("id") Integer id);
}